from django.db import models

# Create your models here.

class Computer(models.Model):
    CPU_TYPES = (
        ('p3', 'PIII'),
        ('p4', 'P4'),
        ('cel', 'Celeron'),
        ('amd', 'AMD'),
        )
    CPU_SPEEDS = (
        ('450', '450'),
        ('550', '550'),
        ('667', '667'),
        ('600', '600'),
        ('633', '633'),
        ('650', '650'),
        ('667', '667'),
        ('700', '700'),
        ('733', '733'),
        ('766', '766'),
        ('800', '800'),
        ('833', '833'),
        ('866', '866'),
        ('900', '900'),
        ('930', '930'),
        ('933', '933'),
        ('1000', '1000'),
        ('1100', '1100'),
        ('1200', '1200'),
        ('1400', '1400'),
        ('1500', '1500'),
        ('1600', '1600'),
        ('1700', '1700'),
        ('1800', '1800'),
        ('1900', '1900'),
        ('2100', '2100'),
        ('2200', '2200'),
        ('2300', '2400'),
        ('2500', '2600'),
        ('2700', '2700'),
        ('2800', '2800'),
        ('2900', '2900'),
        ('3000', '3000'),
        ('3100', '3100'),
        ('3200', '3200'),
        )
    CASE_TYPES = (
        ('tower', 'Desktop - Tower'),
        ('flat', 'Desktop - Horizontal'),
        ('laptop', 'Laptop'),
        )
    RAM_AMOUNTS = (
        ('128', '128'),
        ('192', '192'),
        ('256', '256'),
        ('384', '384'),
        ('512', '512'),
        ('1Gb', '1Gb'),
        )
    HARD_DRIVE_SIZES = (
        ('6.4','6.4'),
        ('8', '8'),
        ('10', '10'),
        ('13', '13'),
        ('20', '20'),
        ('10', '10'),
        ('40', '40'),
        ('80', '80'),
        ('100', '100'),        
        ('120','120'),
        ('160','160'),
        ('200', '200'),
        ('250', '250'),
        ('320', '320'),
        )
    STATUS_CHOICES = (
        ('in_shop', 'In Shop'),
        ('being_built', 'Being Built'),
        ('testing', 'Being Tested'),
        )
    #cbv_no = models.AutoField(primary_key=False)
    cbv_no = models.CharField(max_length=3)
    cpu_type = models.CharField(max_length=3, choices = CPU_TYPES)
    cpu_speed = models.CharField(max_length=4, choices = CPU_SPEEDS)
    case_type = models.CharField(max_length=6, choices = CASE_TYPES)
    ram = models.CharField(max_length=3, choices = RAM_AMOUNTS)
    hard_drive_size = models.CharField(max_length=3, choices = HARD_DRIVE_SIZES)
    optical_device1 = models.CharField(max_length=50)
    optical_device2 = models.CharField(max_length=50) 
    monitor_type = models.CharField(max_length=50)
    monitor_size = models.CharField(max_length=50)  
    modem_type = models.CharField(max_length=50)
    usb = models.CharField(max_length=50)
    usb_ports = models.CharField(max_length=50)
    distroversion = models.CharField(max_length=50)  
    computer_status = models.CharField(max_length=12, choices = STATUS_CHOICES, 
        default = "in_shop")
    baseprice = models.CharField(max_length=50)  
    extraprice = models.CharField(max_length=50)  
    
    def __str__(self):
        return "%s %s Processor, %s Ram, %s Gb HDD, %s (%s)" % (self.cpu_type, 
            self.cpu_speed, self.ram, self.hard_drive_size, self.case_type, 
            self.computer_status)
    ## Give the computer_class model an "Admin Interface" so that staff users 
    ## can add new computers if they wish.
    class Admin:
        pass

###=======================================================================
## Provides details about a 'type' of computer ie, a particular set of 
## components.
## At any particular point in time, three of these 
## can be flagged as basic, standard, or upgrade.   
##class ComputerType(models.Model):
##    computer_type_id = models.AutoField(primary_key=True)
##    cpu_type = models.CharField(max_length=50)
##    cpu_speed = models.CharField(max_length=50)
##    case_type = models.CharField(max_length=50)
##    ram = models.CharField(max_length=50)
##    hard_drive_size = models.CharField(max_length=50)
##    optical_device1 = models.CharField(max_length=50)
##    optical_device2 = models.CharField(max_length=50)
##    
##    monitor_type = models.CharField(max_length=50)
##    monitor_size = models.CharField(max_length=50)
##    
##    modem_type = models.CharField(max_length=50)
##    usb = models.CharField(max_length=50)
##    usb_ports = models.CharField(max_length=50)
##    
##    
##    
##    distroversion = models.CharField(max_length=50)  
##    computer_status = models.CharField(max_length=50)
##    computer_description = models.CharField(max_length=50)#not in final version
##    def __str__(self):
##        return self.computer_description
##    # Give the computer_class model an "Admin Interface" so that staff users 
##    # can add new classses of computer if they wish.
##    class Admin:
##        pass
##
##Provides details about an individual computer 
##class ActualComputer(models.Model):
##    cbvid = models.AutoField(primary_key=True)
##    computer_type = models.ForeignKey(ComputerType)
##    status = models.CharField(max_length=50)
##    description = models.CharField(max_length=50)#not in final version
##    user_pwd = models.CharField(max_length=50, default = 'cbvsys')
##    dialup_pwd = models.CharField(max_length=50)
##    qa_date = models.DateTimeField()
##    from wjContact.contacts.models import Contact
##    qa_by = models.ForeignKey(Contact)
##    def __str__(self):
##        return self.description
##    class Admin:
##        list_display = ('cbvid', 'computer_type', 'status', 'description')
##        list_filter = ['status', 'computer_type']
##        search_fields = ['description', 'cbvid' ]
##    
##
## Lists the components that go into a computer or class of computer
##class Component(models.Model):
##    component_id = models.AutoField(primary_key=True)
##    componentclass = models.CharField(max_length=50)
##    componenttype = models.CharField(max_length=50)
##    component_price = models.CharField(max_length=50)
##    def __str__(self):
##        return self.componenttype
##    # Give the computer_components model an "Admin Interface" so that staff users 
##    # can add new computer components if they wish.
##    class Admin:
##        pass
